package com.zhudi;

import java.io.*;
import java.net.*;
import java.util.*;

public class ChatServer {
    private static Map<String, String> users = new HashMap<>(); // 用户名和密码
    private static Map<String, PrintWriter> onlineUsers = new HashMap<>(); // 在线用户
    private static Map<String, Group> groups = new HashMap<>(); // 群组

    static {
        users.put("user1", "password1");
        users.put("user2", "password2");
    }

    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(12345);
        System.out.println("Server started...");
        
        while (true) {
            Socket clientSocket = serverSocket.accept();
            new Thread(new ClientHandler(clientSocket, users, onlineUsers, groups)).start();
        }
    }
}